public class SubString {

    public static void main(String[] args) {
        StringBuilder stringBuilder=new StringBuilder("hello");
        stringBuilder.append("world");

        StringBuffer stringBuffer=new StringBuffer("hello");
        stringBuffer.append("world");
    }


    public static void main5(String[] args) {
        String str="hello";
        StringBuilder stringBuilder=new StringBuilder();
        stringBuilder.append(str);
        stringBuilder.append("world");

        str=stringBuilder.toString();
        System.out.println(str);

        String str2="hello";
        StringBuilder stringBuilder2=new StringBuilder();
        stringBuilder2.append(str2);
        for(int i=0;i<1000;i++) {
            stringBuilder2.append(i);
        }
        System.out.println(str2);
    }

    public static void main4(String[] args) {
        String str="hello";
        str+="world";
        System.out.println(str);
    }

    public static void main3(String[] args) {
        final int[] arr=new int[]{1,2,3};
        //arr=new int[]{4,5,6};
        arr[0]=99;
    }

    public static void main2(String[] args) {
        String str1="        a  b c  de   f";
        System.out.println(str1);
        System.out.println(str1.trim());//trim方法可以去掉字符串左右两边的空格
    }
    public static void main1(String[] args) {
        String str="abcde";
        String str2=str.substring(1);//从指定下标位置开始向后截取（包括指定下标位置）
        System.out.println(str2);//bcde

        String str3=str.substring(1,3);//截取指定区间，左闭右开
        System.out.println(str3);//bc
    }
}
